import store from '../store/index';

// 获取URL地址参数
const getUrlParam = name => {
    let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
    let r = window.location.search.substr(1).match(reg);
    if (r !== null) return decodeURIComponent(r[2]);
    return null;
};

// 获取code值对应文字
const errorCode = code => {
    let errorText = '';
    let codeValue = store.state.user.codeValue;
    errorText = codeValue['zh'][code];
    return errorText;
};

export { getUrlParam, errorCode };